package com.learning.jquizenglish.common.controller;

import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.learning.jquizenglish.R;
import com.learning.jquizenglish.screen.DoQuizScreen;
import com.learning.jquizenglish.screen.HelpScreen;
import com.learning.jquizenglish.screen.MainScreen;
import com.learning.jquizenglish.screen.SettingScreen;

public class HeaderBarController {

	protected Fragment mFrag;
	public HeaderBarController(Fragment frag){
		mFrag = frag;
	}
	
	public View onCreateHeaderView(LayoutInflater inflater,
			ViewGroup container) {
		if(isShowHeader()){
			View v = inflater.inflate(R.layout.header_bar, container,false);
			return v;
		}
		return null;
	}
	
	private boolean isShowHeader(){
		if (mFrag instanceof MainScreen
				|| mFrag instanceof DoQuizScreen
				|| mFrag instanceof SettingScreen
				|| mFrag instanceof HelpScreen) {
			return true;
		}
		return false;
	}
}
